package ntd.util.str.enums;

import cn.hutool.core.util.ByteUtil;
import cn.hutool.core.util.HexUtil;
import cn.hutool.crypto.SecureUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;
import ntd.util.str.tool.UtilHex;

import java.util.function.Function;

@AllArgsConstructor
public enum EnumStrTransform {

    HEX_TO_DATE_STR_YYYY_MM_DD("16进制转时间", "$hexToDate{", "}", UtilHex::hex2ToLocalDateTime),
    HEX_TO_DOUBLE("16进制转double", "$hexToDouble{", "}", UtilHex::hexToDouble),
    MD5("MD5加密", "$md5{", "}", SecureUtil::md5),
    TO_UPPER_CASE("转大写", "$toUpperCase{", "}", String::toUpperCase),
    TO_HEX("转16进制", "$toHex{", "}", HexUtil::encodeHexStr),
    TIMESTAMP("时间戳", "$timestamp", null, s -> {
        return String.valueOf(System.currentTimeMillis());
    }),
    HEX_TO_STR("16进制转字符串", "$hexToStr{", "}", HexUtil::decodeHexStr)
    ;

    @Getter
    private String name;

    @Getter
    private String startTag;

    @Getter
    private String endTag;

    @Getter
    private Function<String, String> transform;
}
